package com.woniuxy.educationplatform.mapper;

import com.woniuxy.educationplatform.bean.CourseBean;
import com.woniuxy.educationplatform.bean.ProjectBean;
import com.woniuxy.educationplatform.bean.SectionBean;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.Date;

@Mapper
public interface SectionMapper {

    /**
     * 根据id查小节表
     * @param id
     * @return
     */
    @Results({
            @Result(id = true, property = "id", column = "id", javaType = Long.class),
            @Result(property = "sectionName", column = "section_name", javaType = String.class),
            @Result(property = "createTime", column = "create_time", javaType = Date.class),
            @Result(property = "courseBean", column = "fk_course", javaType = CourseBean.class, one =
            @One(select = "com.woniuxy.educationplatform.mapper.CourseMapper.findById", fetchType = FetchType.LAZY))
    })
    @Select("select * from section where id= #{id}")
    SectionBean findById(Long id);
}
